﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DLL;
using Module;

namespace BLL
{
    public class BUserRelation
    {
        #region 字段

        private DUserRelation APP = new DUserRelation();//数据操作对象
        private static BUserRelation instance;

        #endregion

        #region 公共接口
        /// <summary>
        /// 取得
        /// </summary>
        /// <returns>BUserRelation对象</returns>
        public static BUserRelation getInstance()
        {
            if (instance == null)
            {
                instance = new BUserRelation();
            }
            return instance;
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="userRelationInfo"></param>
        /// <returns></returns>
        public bool Insert(UserRelationInfo userRelationInfo)
        {
            if (userRelationInfo == null || userRelationInfo.UserRelationId == 0)
                return false;
            return APP.Insert(userRelationInfo);

        }
         /// <summary>
        /// 更新
        /// </summary>
        /// <param name="userRelationInfo"></param>
        /// <returns></returns>
        public bool Update(UserRelationInfo userRelationInfo)
        {
             if (userRelationInfo == null || userRelationInfo.UserRelationId == 0)
                return false;
             return APP.Update(userRelationInfo);
        }
         /// <summary>
        /// 根据主键删除
        /// </summary>
        /// <param name="userRelationId"></param>
        /// <returns></returns>
        public int Delete(long userRelationId)
        {
            if (userRelationId == 0)
                return 0;
            return APP.Delete(userRelationId);

        }

         /// <summary>
        /// 根据自强会员Id删除
        /// </summary>
        /// <param name="normalUserID"></param>
        /// <returns></returns>
        public int DeleteByNormalId(long normalUserID)
        {
             if (normalUserID == 0)
                return 0;
             return APP.DeleteByNormalId(normalUserID);

        }

        /// <summary>
        /// 根据天使会员Id删除
        /// </summary>
        /// <param name="angelUserID"></param>
        /// <returns></returns>
        public int DeleteByAngellId(long angelUserID)
        {
            if (angelUserID == 0)
                return 0;
            return APP.DeleteByAngellId(angelUserID);
        }

        /// <summary>
        /// 根据自强会员Id获取关系列表
        /// </summary>
        /// <param name="normalUserID"></param>
        /// <returns></returns>
        public List<UserRelationInfo> GetAllRelationByNormalId(long normalUserID)
        {
             if (normalUserID == 0)
                return null;
             return APP.GetAllRelationByNormalId(normalUserID);

        }

        /// <summary>
        /// 根据天使会员Id获取关系列表
        /// </summary>
        /// <param name="angelUserID"></param>
        /// <returns></returns>
        public List<UserRelationInfo> GetAllRelationByAngelId(long angelUserID)
        {
            if (angelUserID == 0)
                return null;
            return APP.GetAllRelationByAngelId(angelUserID);
        }

        public List<UserRelationInfo> GetAllRelationInfo()
        {
            return APP.GetAllRelationInfo();
        }
        public UserRelationInfo GetRelationInfoByID(long userRelationId)
        {
            return APP.GetRelationInfoByID(userRelationId);
        }
        #endregion


        public UserRelationInfo GetRelationInfoByPassportId(string nomalUserPassportId, string angelUserPassportId)
        {
            return APP.GetRelationInfoByPassportId(nomalUserPassportId, angelUserPassportId);
        }
    }
}
